import { HashMap } from "../../api/struct/HashMap";
import { CDPetWake } from "../excel/CDPetWake";



/**
 * 扩展-宠物觉醒
 */
export abstract class CEPetWake {
    /**映射表 */
    protected static stageMap = new HashMap<number, HashMap<number, CDPetWake>>();

    /**初始化 */
    public static init(): void {
        const vs = CDPetWake.datas.getValues();
        for (let i = 0, len = vs.length; i < len; i++) {
            const config = vs[i];
            let map = this.stageMap.get(config.stage);
            if (!map) {
                map = new HashMap<number, CDPetWake>();
                this.stageMap.put(config.stage, map);
            }
            map.put(config.level, config);
        }
    }


    /**
     * 获取数据
     * @param stage 
     * @param level 
     */
    public static getData(stage: number, level: number): CDPetWake {
        const map = this.stageMap.get(stage);
        if (map) {
            return map.get(level);
        }
        return null;
    }
}
